class Solution {
public:
    int smallestRepunitDivByK(int k) {
        
        unordered_set<int> has;
        int len=1;
        long long mod=1%k;
        while(mod!=0){
            if(has.count(mod)){
                cout<<mod<<endl;
                return -1;
            }
            has.insert(mod%k);
            mod=(mod*10+1)%k;
            ++len;
        }

        return len;
    }
};
